# from simcell.world.chemiq import Chemiq
from simcell.genetic.amino import AminoFactory

class Protein:
    """Protein"""
    AMINOS = [AminoFactory.H, AminoFactory.V, AminoFactory.N]
        
    def __init__(self):
        self.strand = []
        self.composition = {AminoFactory.H:0.0, 
                            AminoFactory.V:0.0, 
                            AminoFactory.N:0.0}

        self.mass = 0
        
    def addAmino(self, amino):
        """Add an aminoacid to the chain, and generate some energy in form of heat"""
        
        self.mass += amino.mass
        self.strand.append(amino)
        
        return
        # return Chemiq.heatJoin(self.strand[-2:])
        
    def __str__(self):
        repr  = "length:%d H:%d U:%d N:%d" % (len(self.strand), 
                                              self.composition[AminoFactory.H], 
                                              self.composition[AminoFactory.V],
                                              self.composition[AminoFactory.N])
        return repr
        
    def __repr__(self):
        repr  = str(self) + "\n"
        repr += "".join(map(str, self.strand))
        return repr
